//
//  DYHomeVC.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/10.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYHomeVC.h"
#import "DYHomeView.h"
#import "DYItemView.h"
#import "DYEnterShopVC.h"
#import "DYPaymentCodeVC.h"
#import "DYShareVC.h"
#import "DYManageVC.h"
#import "DYShopHeadlinesVC.h"

#import "DYMemberManagerVC.h"
#import "DYCommentsManageVC.h"
#import "DYMoneyManageVC.h"

@interface DYHomeVC ()

@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)DYHomeNoEnterView *noEnterView;
@property (nonatomic,strong)DYHomeEnterView *enterView;
@property (nonatomic,strong)DYHomeActivityView *activityView;
@property (nonatomic,strong)DYHomeInviteView *inviteView;
@property (nonatomic,strong)DYItemView *itemView;


@end

@implementation DYHomeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title=@"卡福商家端";

}
-(void)rightClick
{
    
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.noEnterView];
    [self.scrollView addSubview:self.enterView];
    
    [self.scrollView addSubview:self.activityView];
    [self.scrollView addSubview:self.inviteView];
    [self.scrollView addSubview:self.itemView];
    
}
-(UIScrollView *)scrollView
{
    if (!_scrollView) {
        _scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-kNavigationStatusHeight-kTabBarHeight)];
        _scrollView.alwaysBounceVertical=YES;
    }
    return _scrollView;
}
-(DYHomeNoEnterView *)noEnterView
{
    if (!_noEnterView) {
        _noEnterView=[[DYHomeNoEnterView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, BILIHEIGHT(130))];
        
        @weakify(self);
        _noEnterView.enterBlock = ^{
            @strongify(self);
            DYEnterShopVC *vc=[[DYEnterShopVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        };
    }
    return _noEnterView;
}
-(DYHomeEnterView *)enterView
{
    if (!_enterView) {
        _enterView = [[DYHomeEnterView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, BILIHEIGHT(130))];
        
        @weakify(self);
        _enterView.paymentCodeBlock = ^{
            @strongify(self);
            DYPaymentCodeVC *vc=[[DYPaymentCodeVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        };
   
    }
    return _enterView;
}
-(DYHomeActivityView *)activityView
{
    if (!_activityView) {
        _activityView=[[DYHomeActivityView alloc]initWithFrame:CGRectMake(0, self.enterView.xhq_bottom+BILIHEIGHT(10), kScreenWidth, BILIHEIGHT(70))];
        
        @weakify(self);
        _activityView.activityBlock = ^(NSString *text) {
            @strongify(self);
            if ([text isEqualToString:@"营销管理"]) {
                DYManageVC *vc=[[DYManageVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }else{
                DYShopHeadlinesVC *vc=[[DYShopHeadlinesVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }
        };
    }
    return _activityView;
}
-(DYHomeInviteView *)inviteView
{
    if (!_inviteView) {
        _inviteView=[[DYHomeInviteView alloc]initWithFrame:CGRectMake(0, self.activityView.xhq_bottom+BILIHEIGHT(10), kScreenWidth, BILIHEIGHT(88))];
        
        @weakify(self);
        _inviteView.inviteBlock = ^{
            @strongify(self);
            DYShareVC *vc=[[DYShareVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        };
    }
    return _inviteView;
}
-(DYItemView *)itemView
{
    if (!_itemView) {
        _itemView=[[DYItemView alloc]initWithFrame:CGRectMake(0, self.inviteView.xhq_bottom+BILIHEIGHT(10), kScreenWidth, BILIHEIGHT(130))];
        _itemView.title=@"商家服务";
        _itemView.dataArray=@[@{@"title":@"会员管理",@"image":@"ic_member"},
                              @{@"title":@"评价管理",@"image":@"ic_pjia"},
                              @{@"title":@"资金管理",@"image":@"ic_zji"}
                              ];
        
        @weakify(self);
        _itemView.itemBlock = ^(NSInteger index) {
            @strongify(self);
            if (index==1) {
                DYMemberManagerVC *vc=[[DYMemberManagerVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }else if (index==2){
                DYCommentsManageVC *vc=[[DYCommentsManageVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }else{
                DYMoneyManageVC *vc=[[DYMoneyManageVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }
        };
    }
    return _itemView;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [self NavaigationColor:[UIColor xhq_base]];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
